<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //微任务会先于渲染前执行
        //document.body.style = 'background:red';
        console.log(1);
        Promise.resolve().then(() => {
            console.log(2);
            document.body.style = 'background:yellow';
        });
        console.log(3);
        //1 3 2
    </script>
</body>

</html>